<template>
  <div id="wisdomPark-section-v1">
    <MyHeadline title="事件接报" :islink="false" />
    <MyCell>
      <div class="content">
        <div class="left">
          <div class="img"></div>
        </div>
        <div class="right">
          <div class="item" v-for="i in data" :key="i">
            <div class="title-box">
              <div class="icon" :style="`background-color: ${i.color};`"></div>
              <div class="title">{{ i.title }}</div>
            </div>
            <div class="value" :style="i.value != 0 ? 'color:' + i.color + ';' : ''">{{ i.value }}个</div>
          </div>
        </div>
      </div>
    </MyCell>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { deepCopy } from '@/utils/utils'
import HtEcharts from '@/base-ui/echarts/index'
import MyCell from '@/components/my-cell/index.vue'
import MyHeadline from '@/components/my-headline/index.vue'

import echartsConfig from '../config/wisdomPark-section-v7/echarts-config'
// ========================= 实例

// ========================= 钩子
onMounted(() => {
  // echarts_init()
})

// ========================= 数据
// echarts 配置
const echarts_options = ref<any>(deepCopy(echartsConfig))
// 数据
const data = ref<any>([
  {
    title: '在线设备',
    value: 6,
    color: '#A2EF4D'
  },
  {
    title: '离线设备',
    value: 0,
    color: '#4095E5'
  },
  {
    title: '故障设备',
    value: 0,
    color: '#BD3124'
  }
])

// ========================= 函数
// 初始化
const echarts_init = () => {
  onEcharts_data(4)
}

// 随机数
const getRandomInt = (min: number, max: number): number => {
  min = Math.ceil(min)
  max = Math.floor(max)
  return Math.floor(Math.random() * (max - min + 1)) + min
}

// echartsV1数据
const onEcharts_data = (num: number) => {}

// ========================= 请求

defineExpose({
  echarts_init
})
</script>

<style scoped lang="less">
#wisdomPark-section-v1 {
  .width_height(100%,100%);
  .content {
    .width_height(100%,166px);
    .D_J_A(space-between,center);
    box-sizing: border-box;
    padding: 0 @space_20;
    .left {
      height: 100%;
      .img {
        .image(66px,100%,url('@/assets/imgs/wisdomPark/lightPole.png'));
      }
      padding-left: 40px;
    }
    .right {
      width: 45%;
      .item {
        .D_J_A(space-between,center);
        margin-bottom: 20px;
        .title-box {
          .D_J_A(space-between,center);
          .icon {
            .width_height(12px,12px);
            margin-right: 22px;
            border-radius: 50%;
          }
          .title {
            .font-S-W-C(14px,400,#fff);
          }
        }
        .value {
          .font-S-W-C(14px,400,#fff);
        }
      }
    }
  }
}
</style>
